package day4;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class Bir {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入入学时间");
        String time = input.next();
        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
        sd.setLenient(false);
        String []pattern={"yyyy-MM-dd","yyyy.MM.dd","yyyyMMdd"};
        for(String pt:pattern){
            sd.applyPattern(pt);
            try {
                Date date = sd.parse(time);
                System.out.println(date);
                return;
            } catch (ParseException e) {
                //e.printStackTrace();
            }
        }
        System.out.println("格式错误！");
    }
}
